package top.gxw.routelearn.view.activity

import android.os.Bundle
import android.util.Log
import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import top.gxw.routelearn.R
import top.gxw.routelearn.base.BaseActivity
import top.gxw.routelearn.base.Constance
import top.gxw.routelearn.model.Dog
import top.gxw.routelearn.model.User

// 在支持路由的页面上添加注解(必选)
// 这里的路径需要注意的是至少需要有两级，/xx/xx
//注入地址
@Route(path = Constance.ACTIVITY_URL_MAIN)
class MainActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

//        //添加注入
//        ARouter.getInstance().inject(this);
        findViewById<View>(R.id.tv_main).setOnClickListener {
            Log.e("GXW", "==============click===========")
            var bb = Dog()
            bb.color = 1
            bb.name = "tump"
            var user = User(18,"GXW",true)
            user.age = 19
            user.name = "GXW2"
            user.isSex = false
            ARouter.getInstance()
                    .build(Constance.ACTIVITY_URL_SECOND)
                    .withString("from", "main")
                    .withObject("dog", bb)
                    .withParcelable("user", user)
                    .navigation()
        }

    }
}